Skip to content

Fix inline parameters lifted for 0 to 1 #4777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

nicolasstucki
Copy link
Contributor

In theory the inline parameters are available in level 1,
but we can access it "unlifted" as a value in level 0.
To only pass the parameter once it is passed as a value and lifted
using the standard lifter for the values.

Unsing lifter is just an implementation detail and should not be observable
by the user. The issue was that the lifter used could be replaced or unimported
which yield unexpected error messages.

In theory the inline parameters are available in level 1,
but we can access it "unlifted" as a value in level 0.
To only pass the parameter once it is passed as a value and lifted
using the standard lifter for the values.

Unsing lifter is just an implementation detail and should not be observable
by the user. The issue was that the lifter used could be replaced or unimported
which yield unexpected error messages.
@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Jul 9, 2018

I originally implemented it with the implicit search thinking it would simplify the implementation logic. Clearly not the case.

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, except a high-level question for another PR:

If inline x: Int, then x should be able to be nested in any levels.


val lifter =
if (tpSym eq defn.BooleanClass) defn.QuotedLiftable_BooleanIsLiftable
else if (tpSym eq defn.ByteClass) defn.QuotedLiftable_ByteLiftable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: the name ByteLiftable is not consistent with other names?

@nicolasstucki nicolasstucki merged commit d28ba06 into scala:master Jul 9, 2018
@Blaisorblade Blaisorblade deleted the fix-inline-parameters-lifted-in-macro branch July 23, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants